From: Keir Fraser Date: Mon, 12 May 2008 10:19:09 +0000 (+0100) Subject: xend: Add syntax check for block devices X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14215^2~25 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=499681128cd67a16b8d9d053f0f5706e2a29d2a2;p=xen.git xend: Add syntax check for block devices If we define wrong values to a disk parameter in domain configuration files, we get an error message or a guest OS panic. 1. If we define a wrong disk type, xm create command error occurs about 100 seconds later. e.g. disk=['xyz:/xen/root-vm1.img,hda1,w'] 2. If we forget a disk type, a guest OS panic occurs. e.g. disk=['/xen/root-vm1.img,hda1,w'] Signed-off-by: Masaki Kanno --- diff --git a/tools/python/xen/xend/server/blkif.py b/tools/python/xen/xend/server/blkif.py index 84d9b23f8e..6305a64ac7 100644 --- a/tools/python/xen/xend/server/blkif.py +++ b/tools/python/xen/xend/server/blkif.py @@ -56,8 +56,12 @@ class BlkifController(DevController): else: try: (typ, params) = string.split(uname, ':', 1) + if typ not in ('phy', 'file'): + raise VmError( + 'Block device must have "phy" or "file" specified to type') except ValueError: - (typ, params) = ("", "") + raise VmError( + 'Block device must have physical details specified') mode = config.get('mode', 'r') if mode not in ('r', 'w', 'w!'):